STATIC_ARGS:=-DSTATIC -static
DYNAMIC_ARGS:=-DDYNAMIC -Wl,-Ttext-segment=0x100000 -L. -Wl,-rpath=.
SO_ARGS:=-DDYNAMIC -fPIC -shared -L.

DYN_LDR := $(TOOLCHAIN_PATH)/arm-nacl/lib/runnable-ld.so

include $(SRC_ROOT)/../tests/test.mk

# Basic Hello World (nostdlib)
$(eval $(call BUILD_STATIC,micro_hello.c,-nostdlib))

# Basic Hello World (with stdlib)
$(eval $(call BUILD_BOTH,libc_hello.c))

# Basic Hello World (nostdlib)
$(eval $(call BUILD_STATIC,glibc_compat.c))

#
# LINKER TESTS
#

# Verify R_ARM_COPY happens after local relocations in libdynamic
$(eval $(call BUILD_SO,dynamic.c,-nostdlib))
$(eval $(call BUILD_DYNAMIC,micro.c,-nostdlib -ldynamic,libdynamic.so))

# Verify re-order of of dependencies Main (A,C); A (B); B (C) puts
# C ahead of B.
$(eval $(call BUILD_SO,dyn_c.c,-nostdlib))
$(eval $(call BUILD_SO,dyn_b.c,-nostdlib -ldyn_c,libdyn_c.so))
$(eval $(call BUILD_SO,dyn_a.c,-nostdlib -ldyn_b,libdyn_b.so))
$(eval $(call BUILD_DYNAMIC,order.c,-nostdlib -ldyn_a -ldyn_c,libdyn_a.so))
$(eval $(call BUILD_BOTH,basic_cpp.cpp,,,1 2 3 4))
